<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <%- include common %>

</head>

<body>
    <%- include("head",{title:"login",username:''}) %>


    <div class="container-fluid">
        <h2 class="text-primary">Welcome To Login</h2>
        <div class="row hr">
            <div class="col-xs-12 col-sm-6">
                <form method="POST" action="/users/signon" class="form-horizontal">
                    <ul id="loginBy" class="nav nav-tabs">
                        <li role="presentation" class="active"><a onclick="changeShow(true)">用户名登陆</a></li>
                        <li role="presentation"><a onclick="changeShow(false)">手机号登录</a></li>
                    </ul>
                    <div class="form-group" id="usernameBox">
                        <label for="inputUsername" class="col-sm-2 control-label">Username</label>
                        <div class="col-sm-10">
                            <input type="text" value="<%- username %>" name="username" class="form-control" id="inputUsername" placeholder="Username">
                        </div>
                    </div>
                    <div class="form-group" id="phoneBox">
                        <label for="inputPhone" class="col-sm-2 control-label">Phone</label>
                        <div class="col-sm-10">
                            <input type="tel" class="form-control" name="phone" id="inputPhone" placeholder="Phone">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputPassword" class="col-sm-2 control-label">Password</label>
                        <div class="col-sm-10">
                            <input type="password" name="password" class="form-control" id="inputPassword" placeholder="Password">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button type="submit" class="btn btn-primary">Sign on</button>
                            <button type="reset" class="btn btn-danger">reset</button>
                        </div>

                    </div>
                </form>
            </div>
        </div>
    </div>


    <%- include("foot") %>
</body>
<script>
    window.onload = function () {
        $("#usernameBox").show()
        $("#phoneBox").hide()
    }

    function changeShow(flag) {
        if (flag) {
            $("#usernameBox").show()
            $("#phoneBox").hide()
            $("#loginBy>li").eq(0).addClass("active").siblings().removeClass("active")
        } else {
            $("#loginBy>li").eq(1).addClass("active").siblings().removeClass("active")
            $("#usernameBox").hide()
            $("#phoneBox").show()
        }
    }
</script>

</html>